# coding: utf-8
__author__ = 'j.tommy'

import config_default
app_configs = None

def merge(configs, override_configs):
    """
    合并override 和 default 配置文档，返回字典
    """
    r = {}

    for k, v in configs.iteritems():
        if k in override_configs:
            if isinstance(v, dict):
                r[k] = merge(v, override_configs[k])
            else:
                r[k] = override_configs[k]
        else:
            r[k] = v
    return r


try:
    import config_override
    config_default = config_default.configs
    app_configs = merge(config_default, config_override.configs)
    print app_configs
except ImportError:
    pass